<template>
	<el-row>
		<el-table :data="companyList" border style="width: 100%">
			<el-table-column label="ID" width="80">
				<template slot-scope="scope">
					<span style="margin-left: 10px">{{ scope.row.id }}</span>
				</template>
			</el-table-column>
			<el-table-column :label="tableHead.companyName" width="180">
				<template slot-scope="scope">
					<span style="margin-left: 10px">{{ scope.row.companyName }}</span>
				</template>
			</el-table-column>
			<el-table-column :label="tableHead.address" width="180">
				<template slot-scope="scope">
					{{ scope.row.address }}
				</template>
			</el-table-column>
			<el-table-column :label="tableHead.contact">
				<template slot-scope="scope">
					{{ scope.row.contact }}
				</template>
			</el-table-column>
			<el-table-column :label="tableHead.phone">
				<template slot-scope="scope">
					{{ scope.row.phone }}
				</template>
			</el-table-column>
			<el-table-column :label="tableHead.isEnable" width="70">
				<template slot-scope="scope">
					<p style="text-align: center">
						<icon name="check" v-if="scope.row.isEnable" style="color: darkgreen"></icon>
						<icon name="ban" v-else style="color: red;"></icon>
					</p>
				</template>
			</el-table-column>
			<el-table-column label="操作" width="70">
				<template slot-scope="scope" >
					<el-button size="small" @click="editCompany(scope.$index, scope.row)">
						<template>
							<icon name="pencil-alt"></icon>
						</template>
					</el-button>
					<!--<el-button size="small" type="danger" @click="deleteCompany(scope.$index, scope.row)">-->
						<!--<template>-->
							<!--<icon name="trash"></icon>-->
						<!--</template>-->
					<!--</el-button>-->
				</template>
			</el-table-column>
		</el-table>
	</el-row>
</template>

<script>
	export default {
		props:['companyList'],
		data(){
			return {
				tableHead:{
					companyName: '公司名称',
					address: '公司地址',
					contact: '联系人',
					phone: '电话',
					isEnable: '可用'
				}
			}
		},
		methods:{
			deleteCompany(i,row){
				this.$emit('triggerDelete',row);
			},
			editCompany(i,row){
				this.$emit('triggerEdit',row);
			},
		}
	}
</script>
